package com.yztc.yidoutang.fragment.darenshuo_fragment;

import com.yztc.yidoutang.bean.DaRenBean;

import java.util.HashMap;
import java.util.Map;

import rx.Subscriber;

/**
 * Created by My on 2016/10/20.
 */

public class DaRenShuoPresenter implements DaRenShuoContract.Presenter{
    private DaRenShuoContract.Model model;
    private DaRenShuoContract.View view;

    public DaRenShuoPresenter(DaRenShuoContract.View view) {
        this.view = view;
        this.model=new DaRenShuoModel();
    }

    @Override
    public void getDRData(String queryWords) {
        Map<String,String> params=new HashMap<>();
        params.put("last_tid","0");
        params.put("q",queryWords);
        model.getDRData(params, new Subscriber<DaRenBean>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onNext(DaRenBean daRenBean) {
                view.GetDRDataSuccess(daRenBean.getData().getGuides());
            }
        });
    }
}
